function sumPrimes(num) {
    let result = 0;
    const minValue = 2;
    outer: for (let i = minValue; i <= num; i++) {
        for (let j = i; j >= minValue; j--) {
            if (j !== i && i % j === 0) {
                continue outer;
            }
        }
        result += i;
    }
    return result;
}

sumPrimes(977);
